import instance from '../../utils/request'

// const base = 'http://192.168.1.37:9002/cookcar-plat/'
const base = 'cookcar-plat/'

// 获取视频信息
export function getVideoMsg(id, uId) {
  const config = {
    method: 'get',
    url: `${base}video/list?vId=${id}&uId=${uId}`,
  }
  return instance(config)
}

// 添加评论
export function setComment(data) {
  const config = {
    method: 'post',
    url: `${base}/mobile/C/comment`,
    data,
  }
  return instance(config)
}

// 获取评论
export function getCommentDetail(data) {
  const config = {
    method: 'get',
    url: `${base}mobile/C/checkComments`,
    params: data
  }
  return instance(config)
}

// 评论点赞增加 
export function getLikeComment(id,flag) {
  const config = {
    method: 'get',
    url: `${base}mobile/C/commentLike?cId=${id}&flag=${flag}`
  }
  return instance(config)
}

// 视频点赞增加
export function getLikeVideo(id, flag) {
  const config = {
    method: 'get',
    url: `${base}mobile/C/like?vId=${id}&flag=${flag}`,
  }
  return instance(config)
}

// 获取主播信息
export function getHost(data) {
  const config = {
    method: 'get',
    url: `${base}mobileHomepage/selectCelebrity`,
    params: data
  }
  return instance(config)
}

// 获取主播信息和视频信息
export function getHostMsgVideo(data) {
  const config = {
    method: 'get',
    url: `${base}mobileHomepage/selectCelebrityVideo`,
    params: data
  }
  return instance(config)
}

// 查询主播平台
export function getHostPlatform(id) {
  const config = {
    method: 'get',
    url: `${base}platform/selectById/${id}`,
  }
  return instance(config)
}

// 查询全部视频
export function getAllList(limit,page,type) {
  const config = {
    method: 'get',
    url: `${base}video/list?limit=${limit}&page=${page}&type=${type}`,
  }
  return instance(config)
}

// 根据title查询指定视频
export function getTitleList(data, page, limit, type) {
  const config = {
    method: 'get',
    url: `${base}video/list?limit=${limit}&page=${page}&videoTitle=${data}&type=${type}&author=${data}`,
  }
  return instance(config)
}

// 根据author查询指定视频
export function getAuthorList(data, page, limit, type) {
  const config = {
    method: 'get',
    url: `${base}video/list?limit=${limit}&page=${page}&author=${data}&type=${type}`,
  }
  return instance(config)
}

// 获取用户id
export function getUserIdData() {
  const config = {
    method: 'get',
    url: `sys-authorize/user/infoMy/getInfo/C`,
  }
  return instance(config)
}

// 添加足迹
export function addFoot(id) {
  const config = {
    method: 'get',
    url: `${base}mobile/C/addFootprint?vId=${id}`
  }
  return instance(config)
}